﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Reflection;
using System.IO;

public partial class Adm_HelpServerVars : System.Web.UI.Page
{
		protected void Page_Load(object sender, EventArgs e)
		{

				IList<string> lista = new List<string>(); 
				foreach (object variabile in Request.ServerVariables)
				{
						lista.Add(variabile.ToString() + "=" + Request.ServerVariables[variabile.ToString()].ToString());
				}
				this.grdVariables.DataSource = lista;
				this.grdVariables.DataBind();

				string fp = Request.ServerVariables["APPL_PHYSICAL_PATH"];
				var curDir = Directory.GetCurrentDirectory();
				string rapp = Request.ApplicationPath;
				string[] confFiles = Directory.GetFiles(fp, "*.config");

				string txt = "Directory.GetCurrentDirectory() = " + curDir + "</br>\n\r" +
				"Request.ApplicationPath = " + rapp + "</br>" +
				"Request.ServerVariables['APPL_PHYSICAL_PATH'] = " + fp + "</br>" +
				"Files .config trovati : " + confFiles.Length.ToString() + "</br>";
				foreach (var item in confFiles)
				{
						txt += item + "</br>";
				}
				txt += "\n";
				
				Response.Write("principal : "+ System.Security.Principal.WindowsIdentity.GetCurrent().Name) ; 
				


				this.LblCurrentBuild.Text = "Build " + Assembly.GetExecutingAssembly().GetName().Version.ToString()+"</br>"+ txt;
				//this.LblCurrentCopyright.Text = ((AssemblyCopyrightAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0]).Copyright;

		}//fM
		
}
